<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>15_trimRight or trimEnd</title>
</head>

<body>
  <script>
    /**
     * trimRight() / trimEnd()
     * 语法: 
     *    => 字符串.trimRight()
     *    => 字符串.trimEnd()
     * 作用: 去除字符串后面的空白内容
     * 返回值: 去除后面空白内容以后的字符串
    */

    var str = '       hello world        ';
    console.log('原始字符串:', str,  str.length);

    var result1 = str.trimRight();
    console.log('去除后面空白:', result1, result1.length);

    var result2 = str.trimEnd();
    console.log('去除后面空白:', result2, result2.length);
  </script>
</body>

</html>
